package CAPA_INTERFAZ_DE_USUARIO;

import CAPA_LOGICA_DE_NEGOCIO.LN_LOGICA_NEGOCIO;
import RECURSOS.FONDO_FORM;
import RECURSOS.LOG;
import RECURSOS.MARCA;
import RECURSOS.MODELO;
import RECURSOS.PRODUCTO;
import RECURSOS.TIPO_PRODUCTO;

import java.awt.Image;
import java.awt.Toolkit;
import javax.swing.InputVerifier;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.JTextPane;
        
public class IU_INGRESO_PRODUCTO extends javax.swing.JFrame {                                                                  
    
    private LN_LOGICA_NEGOCIO obj_ln;
    private PRODUCTO obj_producto;
    private FONDO_FORM F;
    
    @Override    
    public Image getIconImage() {
        Image retValue = Toolkit.getDefaultToolkit().getImage(ClassLoader.getSystemResource("RECURSOS/SOVI.PNG"));
        return retValue;
    }           
    
    public IU_INGRESO_PRODUCTO() {                              
        initComponents();                
        this.setLocationRelativeTo(null);
        obj_ln=new LN_LOGICA_NEGOCIO();        
        obj_producto = new PRODUCTO();
        obj_producto.setModelo(new MODELO());
        obj_producto.getModelo().setMarca(new MARCA());
        obj_producto.setTipo_prod(new TIPO_PRODUCTO());         
        this.txt_preciocompra.setInputVerifier(new Verificar_solo_Decimal());
        this.txt_precioventa.setInputVerifier(new Verificar_solo_Decimal());
        
        
        F=new FONDO_FORM(this.getWidth(),this.getHeight(),"fondo.png");
        this.add(F);
        this.pack();                
        this.lbl_codigo.setVisible(false);
        this.txt_codigo.setVisible(false);
    }

    //GETTERS
    
    public FONDO_FORM getF() {
        return F;
    }
        
    public JLabel getLbl_codigo() {
        return lbl_codigo;
    }

    public JTextField getTxt_codigo() {
        return txt_codigo;
    }       

    public JLabel getLbl_titulo() {
        return lbl_titulo;
    }

    public JComboBox getCbx_marca() {
        return cbx_marca;
    }

    public JComboBox getCbx_tipoproducto() {
        return cbx_tipoproducto;
    }

    public JTextField getTxt_cantidad() {
        return txt_cantidad;
    }

    public JTextPane getTxt_descripcion() {
        return txt_descripcion;
    }

    public JTextField getTxt_modelo() {
        return txt_modelo;
    }

    public JTextField getTxt_preciocompra() {
        return txt_preciocompra;
    }

    public JTextField getTxt_precioventa() {
        return txt_precioventa;
    }            

    public JButton getBtn_guardar() {
        return btn_guardar;
    }      

    public LN_LOGICA_NEGOCIO getObj_ln() {
        return obj_ln;
    }    

    public PRODUCTO getObj_producto() {
        return obj_producto;
    }

    public void setObj_producto(PRODUCTO obj_producto) {
        this.obj_producto = obj_producto;
    }        
    
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel2 = new javax.swing.JLabel();
        cbx_tipoproducto = new javax.swing.JComboBox();
        cbx_marca = new javax.swing.JComboBox();
        lbl_titulo = new javax.swing.JLabel();
        lbl_tipo_producto = new javax.swing.JLabel();
        lbl_marca = new javax.swing.JLabel();
        lbl_descripcion = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        txt_descripcion = new javax.swing.JTextPane();
        lbl_modelo = new javax.swing.JLabel();
        btn_guardar = new javax.swing.JButton();
        lbl_p_compra = new javax.swing.JLabel();
        lbl_cantidad = new javax.swing.JLabel();
        txt_preciocompra = new javax.swing.JTextField();
        lbl_p_venta = new javax.swing.JLabel();
        txt_cantidad = new javax.swing.JTextField();
        txt_modelo = new javax.swing.JTextField();
        txt_precioventa = new javax.swing.JTextField();
        btn_cancelar = new javax.swing.JButton();
        txt_codigo = new javax.swing.JTextField();
        lbl_codigo = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();

        jLabel2.setText("jLabel2");

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("SOVI");
        setBackground(new java.awt.Color(0, 0, 0));
        setIconImage(getIconImage());
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });

        lbl_titulo.setFont(new java.awt.Font("Cambria", 1, 18)); // NOI18N
        lbl_titulo.setForeground(new java.awt.Color(0, 0, 112));
        lbl_titulo.setText("INGRESO DE PRODUCTO");

        lbl_tipo_producto.setBackground(new java.awt.Color(255, 255, 255));
        lbl_tipo_producto.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        lbl_tipo_producto.setForeground(new java.awt.Color(0, 0, 102));
        lbl_tipo_producto.setText("Tipo de Producto");

        lbl_marca.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        lbl_marca.setForeground(new java.awt.Color(0, 0, 102));
        lbl_marca.setText("Marca");

        lbl_descripcion.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        lbl_descripcion.setForeground(new java.awt.Color(0, 0, 102));
        lbl_descripcion.setText("Descripcion");

        txt_descripcion.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        txt_descripcion.setForeground(new java.awt.Color(0, 0, 102));
        jScrollPane1.setViewportView(txt_descripcion);

        lbl_modelo.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        lbl_modelo.setForeground(new java.awt.Color(0, 0, 102));
        lbl_modelo.setText("Modelo");

        btn_guardar.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        btn_guardar.setForeground(new java.awt.Color(0, 0, 102));
        btn_guardar.setText("GUARDAR");
        btn_guardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_guardarActionPerformed(evt);
            }
        });

        lbl_p_compra.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        lbl_p_compra.setForeground(new java.awt.Color(0, 0, 102));
        lbl_p_compra.setText("Precio de Compra");

        lbl_cantidad.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        lbl_cantidad.setForeground(new java.awt.Color(0, 0, 102));
        lbl_cantidad.setText("Cantidad");

        txt_preciocompra.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        txt_preciocompra.setForeground(new java.awt.Color(0, 0, 102));
        txt_preciocompra.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txt_preciocompraKeyTyped(evt);
            }
        });

        lbl_p_venta.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        lbl_p_venta.setForeground(new java.awt.Color(0, 0, 102));
        lbl_p_venta.setText("Precio de Venta");

        txt_cantidad.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        txt_cantidad.setForeground(new java.awt.Color(0, 0, 102));
        txt_cantidad.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txt_cantidadKeyTyped(evt);
            }
        });

        txt_modelo.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        txt_modelo.setForeground(new java.awt.Color(0, 0, 102));

        txt_precioventa.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        txt_precioventa.setForeground(new java.awt.Color(0, 0, 102));
        txt_precioventa.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                txt_precioventaKeyTyped(evt);
            }
        });

        btn_cancelar.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        btn_cancelar.setForeground(new java.awt.Color(0, 0, 102));
        btn_cancelar.setText("CANCELAR");
        btn_cancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_cancelarActionPerformed(evt);
            }
        });

        txt_codigo.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        txt_codigo.setForeground(new java.awt.Color(0, 0, 102));
        txt_codigo.setEnabled(false);

        lbl_codigo.setFont(new java.awt.Font("Cambria", 0, 14)); // NOI18N
        lbl_codigo.setForeground(new java.awt.Color(0, 0, 102));
        lbl_codigo.setText("Código");

        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/RECURSOS/logosovi.png"))); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(80, 80, 80)
                        .addComponent(jLabel3)
                        .addGap(10, 10, 10)
                        .addComponent(lbl_titulo, javax.swing.GroupLayout.PREFERRED_SIZE, 290, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(120, 120, 120)
                        .addComponent(lbl_codigo)
                        .addGap(89, 89, 89)
                        .addComponent(txt_codigo, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(120, 120, 120)
                        .addComponent(lbl_tipo_producto)
                        .addGap(27, 27, 27)
                        .addComponent(cbx_tipoproducto, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(120, 120, 120)
                        .addComponent(lbl_marca)
                        .addGap(93, 93, 93)
                        .addComponent(cbx_marca, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(120, 120, 120)
                        .addComponent(lbl_modelo)
                        .addGap(86, 86, 86)
                        .addComponent(txt_modelo, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(120, 120, 120)
                        .addComponent(lbl_cantidad)
                        .addGap(75, 75, 75)
                        .addComponent(txt_cantidad, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(120, 120, 120)
                        .addComponent(lbl_p_compra)
                        .addGap(23, 23, 23)
                        .addComponent(txt_preciocompra, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(120, 120, 120)
                        .addComponent(lbl_p_venta)
                        .addGap(36, 36, 36)
                        .addComponent(txt_precioventa, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(120, 120, 120)
                        .addComponent(lbl_descripcion)
                        .addGap(59, 59, 59)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(170, 170, 170)
                        .addComponent(btn_guardar)
                        .addGap(45, 45, 45)
                        .addComponent(btn_cancelar)))
                .addContainerGap(36, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(30, 30, 30)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(30, 30, 30)
                        .addComponent(lbl_titulo)))
                .addGap(17, 17, 17)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbl_codigo)
                    .addComponent(txt_codigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(6, 6, 6)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbl_tipo_producto)
                    .addComponent(cbx_tipoproducto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(10, 10, 10)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbl_marca)
                    .addComponent(cbx_marca, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(10, 10, 10)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbl_modelo)
                    .addComponent(txt_modelo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(16, 16, 16)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbl_cantidad)
                    .addComponent(txt_cantidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(16, 16, 16)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbl_p_compra)
                    .addComponent(txt_preciocompra, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(16, 16, 16)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbl_p_venta)
                    .addComponent(txt_precioventa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(26, 26, 26)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbl_descripcion)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(33, 33, 33)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btn_guardar)
                    .addComponent(btn_cancelar))
                .addContainerGap(53, Short.MAX_VALUE))
        );

        txt_codigo.getAccessibleContext().setAccessibleDescription("");
        lbl_codigo.getAccessibleContext().setAccessibleDescription("");

        pack();
    }// </editor-fold>//GEN-END:initComponents
  
    private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
        
        cargar_combo_tipo_producto();  
        if(getObj_producto().getTipo_prod().getDesc_tipo_producto()!=null && getObj_producto().getModelo().getMarca().getNombre_marca()!=null)
        {        
            this.getCbx_tipoproducto().setSelectedItem(getObj_producto().getTipo_prod().getDesc_tipo_producto());         
            this.getCbx_marca().setSelectedItem(getObj_producto().getModelo().getMarca().getNombre_marca());
        }
    }//GEN-LAST:event_formWindowOpened

     public void cargar_combo_tipo_producto() {        
         try{         
             cbx_tipoproducto.setModel(obj_ln.consultar_combo(obj_producto.getTipo_prod()));         
             cargar_combo_marca();
         }
         catch(NullPointerException e)
         {
             LOG l=new LOG();
             JOptionPane.showMessageDialog(null,obj_ln.error_usuario(obj_producto.getTipo_prod().getError()),"ERROR",JOptionPane.ERROR_MESSAGE);                    
             String log="Tipo: "+obj_producto.getTipo_prod().getError().getTipo_error()+". Mensaje: "+obj_producto.getTipo_prod().getError().getDescripcion_error();             
             l.escribir(log);                          
             this.dispose();
             
         }                      
    }
     
     public void cargar_combo_marca() {                                          
         try
         {         
             cbx_marca.setModel(obj_ln.consultar_combo(obj_producto.getModelo().getMarca()));
         }
         catch(NullPointerException e)
         {          
             LOG l=new LOG();
             JOptionPane.showMessageDialog(null,obj_ln.error_usuario(obj_producto.getModelo().getMarca().getError()),"ERROR",JOptionPane.ERROR_MESSAGE);                    
             String log="Tipo: "+obj_producto.getModelo().getMarca().getError().getTipo_error()+". Mensaje: "+obj_producto.getModelo().getMarca().getError().getDescripcion_error();                             
             l.escribir(log);
             this.dispose();
         }                          
    }
     
    private void btn_guardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_guardarActionPerformed

        if(!txt_cantidad.getText().isEmpty() && 
                       !txt_modelo.getText().isEmpty() && 
                       !txt_descripcion.getText().isEmpty()            
          )
        {
                if(Double.parseDouble(txt_preciocompra.getText()) > 0)
                {
                    if(Double.parseDouble(txt_preciocompra.getText()) < Double.parseDouble(txt_precioventa.getText()))
                    {
                        obj_producto = new PRODUCTO(0,String.valueOf(cbx_tipoproducto.getSelectedItem()),txt_modelo.getText().toUpperCase(),Integer.parseInt(txt_cantidad.getText()),Double.parseDouble(txt_preciocompra.getText()),Double.parseDouble(txt_precioventa.getText()),String.valueOf(txt_descripcion.getText()));
                        obj_producto.getModelo().setMarca(new MARCA(0,String.valueOf(getCbx_marca().getSelectedItem())));                              
                        
                        obj_ln.guardarprod(obj_producto);                       

                        if(obj_producto.getError().getTipo_error()==null)
                        {
                            JOptionPane.showMessageDialog(null,"Ingreso Exitoso!","Producto Guardado",JOptionPane.INFORMATION_MESSAGE);
                            this.dispose();
                        }
                        else
                        {
                            LOG l=new LOG();                
                            if(obj_producto.getModelo().getError().getTipo_error()!=null)
                            {
                                JOptionPane.showMessageDialog(null,obj_ln.error_usuario(obj_producto.getModelo().getError()),"ERROR",JOptionPane.ERROR_MESSAGE);                    
                                String log="Tipo: "+obj_producto.getModelo().getError().getTipo_error()+". Mensaje: "+obj_producto.getModelo().getError().getDescripcion_error();
                                l.escribir(log);                    
                            }                    
                            else
                            {                                                                                    
                                JOptionPane.showMessageDialog(null,obj_ln.error_usuario(obj_producto.getError()),"ERROR",JOptionPane.ERROR_MESSAGE);                                
                                String log="Tipo: "+obj_producto.getError().getTipo_error()+". Mensaje: "+obj_producto.getError().getDescripcion_error();                                        
                                l.escribir(log);                                                
                            }
                        }                        
                    }
                    else                        
                    {
                        JOptionPane.showMessageDialog(null,"EL PRECIO DE VENTA NO PUEDE SER MENOR NI IGUAL AL PRECIO DE COMPRA","ERROR",JOptionPane.ERROR_MESSAGE);
                    }
                }
                else
                {
                    JOptionPane.showMessageDialog(null,"EL PRECIO DE COMPRA NO PUEDE SER CERO","ERROR",JOptionPane.ERROR_MESSAGE);                                
                }
        }
        else
        {
            JOptionPane.showMessageDialog(null,"LLENE TODOS LOS CAMPOS","ERROR",JOptionPane.ERROR_MESSAGE);                                
        }
    }//GEN-LAST:event_btn_guardarActionPerformed

    private void btn_cancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_cancelarActionPerformed
        this.dispose();        
    }//GEN-LAST:event_btn_cancelarActionPerformed

     public class Verificar_solo_Decimal extends InputVerifier {
        public boolean verify(JComponent editor) {
            if (editor instanceof JTextField)
            {
                String clave = ((JTextField)editor).getText();
                try
                {
                    Double.parseDouble(clave);
                    return true;
                }
                catch (Exception e)
                {
                    JOptionPane.showMessageDialog(null, "Ingrese un numero valido","Numero no Valido",JOptionPane.ERROR_MESSAGE);
                   ((JTextField)editor).setText("");
                    return false;
                }
            }
            return true;
        }
    }
    
    private void txt_cantidadKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_cantidadKeyTyped

        char car = evt.getKeyChar();
        if((car<'0' || car>'9')) evt.consume();        // TODO add your handling code here:
    }//GEN-LAST:event_txt_cantidadKeyTyped

    private void txt_preciocompraKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_preciocompraKeyTyped
        char car = evt.getKeyChar();
        if((car<'0' || car>'9') && car!='.') evt.consume();                
    }//GEN-LAST:event_txt_preciocompraKeyTyped

    private void txt_precioventaKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txt_precioventaKeyTyped
        txt_preciocompraKeyTyped(evt);        
    }//GEN-LAST:event_txt_precioventaKeyTyped
    
    public static void main(String args[]) {
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(IU_INGRESO_PRODUCTO.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(IU_INGRESO_PRODUCTO.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(IU_INGRESO_PRODUCTO.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(IU_INGRESO_PRODUCTO.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>        
        java.awt.EventQueue.invokeLater(new Runnable() {            
            public void run() {                
                IU_INGRESO_PRODUCTO jframe=new IU_INGRESO_PRODUCTO();                
                jframe.setVisible(true);                                  
            }
        });        
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btn_cancelar;
    private javax.swing.JButton btn_guardar;
    private javax.swing.JComboBox cbx_marca;
    private javax.swing.JComboBox cbx_tipoproducto;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel lbl_cantidad;
    private javax.swing.JLabel lbl_codigo;
    private javax.swing.JLabel lbl_descripcion;
    private javax.swing.JLabel lbl_marca;
    private javax.swing.JLabel lbl_modelo;
    private javax.swing.JLabel lbl_p_compra;
    private javax.swing.JLabel lbl_p_venta;
    private javax.swing.JLabel lbl_tipo_producto;
    private javax.swing.JLabel lbl_titulo;
    private javax.swing.JTextField txt_cantidad;
    private javax.swing.JTextField txt_codigo;
    private javax.swing.JTextPane txt_descripcion;
    private javax.swing.JTextField txt_modelo;
    private javax.swing.JTextField txt_preciocompra;
    private javax.swing.JTextField txt_precioventa;
    // End of variables declaration//GEN-END:variables
}
